
<section class="content-header">
	<h1>
		{{title}}<small></small>
	</h1>
</section>
<section class="content">
	<div class="box box-default">
		<div class="col-md-12">
			<div class="box-body" ng-controller="goods as gt">
				<alertdanger></alertdanger>
				<alertsuccess></alertsuccess>
				<form role="form">
					<div class="box-body">
					<div class="form-group">
						<label> <input type="radio" ng-model="isoutsite"
							ng-value="1" class="flat-red" ng-checked="true" ng-change="isoutsitechange();">站内商品
						</label> <label> <input type="radio" ng-model="isoutsite"
							ng-value="0" class="flat-red" ng-change="isoutsitechange();" >站外商品
						</label>
					</div>
					<div ng-show="outsitelinkshow" class="form-group">
						<label>外链地址</label> <input maxlength="255" ng-model="outsitelink"
							class="form-control" type="text" placeholder="请输入外链地址">
					</div>
					<div ng-show="outsiteshow">

						<div class="box box-success">
							<div class="box-header with-border">
								<h3 class="box-title">搜索货物</h3>
							</div>
							<div class="box-body">
								<div  class="form-group" ng-init="findallgoodstype();">
									<label>商品类型</label> <select ng-change="goodstypechange();"
										ng-model="selectedgoodstype"
										ng-options="gs.name for gs in goodstypeselect"
										class="form-control select2" style="width: 100%;">
										<option ng－value="-1">--请选择--</option>
									</select>
								</div>
								<div class="form-group">
									<label>货号</label> <input maxlength="20" ng-model="psn"
										class="form-control" type="text" placeholder="请输入货号进行搜索">
								</div>
								<div ng-show="navcategoryshow" class="form-group" ng-init="findNavAll();">
									<label>一级分类</label>
									<select ng-change="navchange();"
										ng-model="selectednav"
										ng-options="gs.name for gs in navselect"
										class="form-control select2" style="width: 100%;">
										<option ng－value="-1">--请选择--</option>
									</select>
								</div>
								<div ng-show="ltypecategoryshow" class="form-group">
									<label>二级分类</label>
									<select ng-change="ltypechange();"
										ng-model="selectedltype"
										ng-options="gs.name for gs in ltypeselect"
										class="form-control select2" style="width: 100%;">
										<option ng－value="-1">--请选择--</option>
									</select>
								</div>
								<div ng-show="stypecategoryshow" class="form-group">
									<label>三级分类</label>
									<select
										ng-model="selectedstype"
										ng-options="gs.name for gs in stypeselect"
										class="form-control select2" style="width: 100%;">
										<option ng－value="-1">--请选择--</option>
									</select>
								</div>
								<div  class="form-group">
									<button class="btn btn-default btn-block btn-sm" ng-click="filterSearchProduct();">搜索货物</button>
								</div>
							</div>
						</div>
						<div class="box box-success">
							<div class="box-header with-border">
								<h3 class="box-title">货物搜索结果列表</h3>
							</div>

							<div class="box-body table-responsive no-padding">
								<table class="table table-hover">
									<tr>
										<th>图片</th>
										<th>货物名称</th>
										<th>库存</th>
										<th>所属商品类型</th>
										<th>所属品牌</th>
										<th>成本价格</th>
										<th>会员价格</th>
										<th>市场价格</th>
										<th>销售价格</th>
										<th>操作</th>
									</tr>
									<tr ng-repeat="at in searchresult">
										<td><img class="direct-chat-img" src="{{basepath}}{{at.mainimg}}" alt="img" /></td>
										<td>{{at.productname}}</td>
										<td>{{at.stock}}</td>
										<td>{{at.goodstypename}}</td>
										<td>{{at.brandname}}</td>
										<td>{{at.cost}}</td>
										<td>{{at.memberprice}}</td>
										<td>{{at.price}}</td>
										<td>{{at.saleprice}}</td>
										<td><button ng-click="pushToSelectedProducts($index,at)" class=".btn-xs">选定</button></td>
									</tr>
								</table>
							</div>
						</div>
						<div class="box box-success">
							<div class="box-header with-border">
								<h3 class="box-title">已选择货物</h3>
							</div>
							<div class="box-body" ng-repeat="at in selectedproducts">
								<div class="col-md-4">
              	<div class="box box-widget widget-user">
                <div class="widget-user-header bg-green">
                 {{at.brandname}}-{{at.productname}}
                
                </div>
								<div class="widget-user-image">
                  <img class="img-circle" src="{{at.mainimg}}" alt="img">
                </div>
                <div class="box-footer">
                  <div class="row">
                    <div class="col-sm-4 border-right">
                      <div class="description-block">
                        <h5 class="description-header">{{at.cost|currency:"¥"}}</h5>
                        <span class="description-text">成本价</span>
                      </div>
                    </div>
                    <div class="col-sm-4 border-right">
                      <div class="description-block">
												<h5 class="description-header">{{at.memberprice|currency:"¥"}}</h5>
                        <span class="description-text">会员价</span>
                      </div>
                    </div>
                    <div class="col-sm-4">
                      <div class="description-block">
												<h5 class="description-header">{{at.stock|number}}</h5>
                        <span class="description-text">库存</span>
                      </div>
                    </div>
                  </div>
                </div>
              	</div>
            		</div>
							</div>
						</div>
						</div>
						<div ng-show=lastgoodstypenameshow class="form-group">
							<label>商品类型</label>
							<input maxlength="20" required="required"
								ng-model="lastgoodstypename" class="form-control" type="text" readonly>
						</div>
						<div ng-show="modifygoodstypeshow" class="form-group">
							<button class="btn btn-default btn-block btn-sm" ng-click="clickmodifygoodstype();">修改商品类型</button>
						</div>

						<div ng-show="goodstypeshow" class="form-group" ng-init="findallgoodstype();">
							<label>商品类型</label> <select ng-change="goodstypechange();"
								ng-model="selectedgoodstype"
								ng-options="gs.name for gs in goodstypeselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>
						<div ng-show=lastbrandnameshow class="form-group">
							<label>品牌</label>
							<input maxlength="20" required="required"
								ng-model="lastbrandname" class="form-control" type="text" readonly>
						</div>
						<div ng-show="modifybrandnameshow" class="form-group">
							<button class="btn btn-default btn-block btn-sm" ng-click="clickmodifybrandname();">修改品牌</button>
						</div>
						<div ng-show="brandnameshow" class="form-group">
							<label>品牌</label> <select ng-change="brandchange();"
								ng-model="selectedbrands"
								ng-options="gs.brandname for gs in brandsselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>

						<div class="box box-info">
              <div class="box-header with-border">
                <h3 class="box-title">商品属性填写区域</h3>
              </div>
              <div class="box-body">
              <div class="form-group" ng-repeat="attr in goodsattrs">
								<label>{{attr.goodsattributename}}</label>
								<input maxlength="100" required="required" ng-model="attr.sval" class="form-control" type="text" placeholder="请输入参数">
							</div>
              </div>
		        </div>
						<div ng-show=lastcategoryshow class="form-group">
							<label>分类</label>
							<input maxlength="20" required="required"
								ng-model="lastcategory" class="form-control" type="text" readonly>
							<input type="hidden" ng-model="lastbrandid"/>
						</div>
						<div ng-show="modifycategoryshow" class="form-group">
							<button class="btn btn-default btn-block btn-sm" ng-click="clickmodifycategory();">修改分类</button>
						</div>
						<div ng-show="navcategoryshow" class="form-group" ng-init="findNavAll();">
							<label>一级分类</label>
							<select ng-change="navchange();"
								ng-model="selectednav"
								ng-options="gs.name for gs in navselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>
						<div ng-show="ltypecategoryshow" class="form-group">
							<label>二级分类</label>
							<select ng-change="ltypechange();"
								ng-model="selectedltype"
								ng-options="gs.name for gs in ltypeselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>
						<div ng-show="stypecategoryshow" class="form-group">
							<label>三级分类</label>
							<select
								ng-model="selectedstype"
								ng-options="gs.name for gs in stypeselect"
								class="form-control select2" style="width: 100%;">
								<option ng－value="-1">--请选择--</option>
							</select>
						</div>
						<div class="form-group">
							<label>商品标题</label> <input maxlength="100" required="required"
								ng-model="goodsname" class="form-control" type="text"
								placeholder="请输入商品标题">
						</div>
						<div class="form-group">
							<label>副商品标题</label> <input maxlength="100" ng-model="subgoodsname"
								class="form-control" type="text" placeholder="请输入副商品标题">
						</div>
						<div class="form-group">
							<label>最低价格</label> <input maxlength="20" ng-value="1"
								ng-model="minprice" class="form-control" type="text"
								placeholder="请输入最低价格">
						</div>
						<div class="form-group">
							<label>最高价格</label> <input maxlength="20" ng-value="1"
								ng-model="maxprice" class="form-control" type="text"
								placeholder="请输入最高价格">
						</div>
						<div class="form-group">
							<label>总虚拟销量</label> <input maxlength="20" ng-value="100"
								ng-model="allvsales" class="form-control" type="number"
								placeholder="请输入总虚拟销量">
						</div>
						<div class="form-group">
							<label>总真实销量</label> <input maxlength="20" ng-value="100"
								ng-model="allsales" class="form-control" type="number"
								placeholder="请输入总真实销量">
						</div>
						<div class="form-group">
							<label>总评论</label> <input maxlength="20" ng-value="100"
								ng-model="alltotalcomment" class="form-control" type="number"
								placeholder="请输入总评价">
						</div>
						<div class="form-group">
							<label>总赞</label> <input maxlength="20" ng-value="100"
								ng-model="alltotalzan" class="form-control" type="number"
								placeholder="请输入总赞">
						</div>
						<div class="form-group">
							<label>搜索关键字</label> <input maxlength="100" ng-model="metakey"
								class="form-control" type="text" placeholder="请输入搜索关键字">
						</div>
						<div class="form-group">
							<label>搜索描述</label> <input maxlength="255" ng-model="metades"
								class="form-control" type="text" placeholder="请输入搜索描述">
						</div>
						<div class="form-group">
							<label>业务代码</label> <input maxlength="45" ng-model="servicecode"
								class="form-control" type="text" placeholder="请输入业务代码">
						</div>
						<div class="form-group">
							<label>排序</label> <input maxlength="3" value="1"
								ng-model="sort" class="form-control" type="text"
								placeholder="请输入数字">
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="msync"
								ng-value="1" class="flat-red" ng-checked="true">同步到移动端使用
							</label> <label> <input type="radio" ng-model="msync"
								ng-value="0" class="flat-red">只在电脑端使用
							</label>
						</div>
						<div class="form-group">
							<label> <input type="radio" ng-model="status"
								ng-value="1" class="flat-red" ng-checked="true"> 启用
							</label> <label> <input type="radio" ng-model="status"
								ng-value="0" class="flat-red"> 禁用
							</label>

						</div>
						<div class="form-group">
	                      <label>商品清单</label>
	                      <textarea ng-model="commoditylist" class="form-control" rows="8" placeholder="请输入商品清单"></textarea>
	                    </div>
	                    <div class="form-group" >
	                      <label>商品介绍</label>
	                      <div class="ueditor" ng-model="detail"></div>
	                    </div>
	                    <textarea ng-model="detail"></textarea>
						<div class="form-group">
							<label>主图</label>
							<div ngf-drop ngf-select ng-model="rmainfiles" class="drop-box"
								ngf-drag-over-class="'dragover'" ngf-multiple="true"
								ngf-allow-dir="true" accept="image/*" ngf-pattern="'image/*'">
								<button class="btn btn-default btn-block btn-sm">选择文件</button>
								<div ngf-no-file-drop>File Drag/Drop is not supported for
									this browser</div>
							</div>
							<div class='box-body'>
								<div class="progress progress-sm active">
									<div
										class="progress-bar progress-bar-success progress-bar-striped"
										role="progressbar" aria-valuenow="0" aria-valuemin="0"
										aria-valuemax="100" style="width: {{rmainprogress}}%">
										<span class="sr-only">20% Complete</span>
									</div>
								</div>
								<div ng-repeat="img in allrmainfiles">
									<div ng-if="img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrmainfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.normalfilepath}}" alt="Photo"> <img
												class="img-responsive pad" ng-src="{{img.compressfilepath}}"
												alt="Photo">

										</div>
									</div>
									<div ng-if="!img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrmainfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.normalfilepath}}" alt="Photo">

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.compressfilepath}}" alt="Photo">

										</div>


									</div>
								</div>

							</div>
						</div>
						<div class="form-group">
							<label>图集</label>
							<div ngf-drop ngf-select ng-model="rfiles" class="drop-box"
								ngf-drag-over-class="'dragover'" ngf-multiple="true"
								ngf-allow-dir="true" accept="image/*" ngf-pattern="'image/*'">
								<button class="btn btn-default btn-block btn-sm">选择文件</button>
								<div ngf-no-file-drop>File Drag/Drop is not supported for
									this browser</div>
							</div>
							<div class='box-body'>
								<div class="progress progress-sm active">
									<div
										class="progress-bar progress-bar-success progress-bar-striped"
										role="progressbar" aria-valuenow="0" aria-valuemin="0"
										aria-valuemax="100" style="width: {{rprogress}}%">
										<span class="sr-only">20% Complete</span>
									</div>
								</div>
								<div ng-repeat="img in allrfiles">
									<div ng-if="img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.normalfilepath}}" alt="Photo"> <img
												class="img-responsive pad" ng-src="{{img.compressfilepath}}"
												alt="Photo">

										</div>
									</div>
									<div ng-if="!img.isCloudImg">
										<div class="alert alert-success alert-dismissable">
											<button ng-click="removeallrfiles($index)" type="button" class="close"
												data-dismiss="alert" aria-hidden="true">&times;</button>

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.normalfilepath}}" alt="Photo">

											<img class="img-responsive pad"
												ng-src="{{img.basepath+img.compressfilepath}}" alt="Photo">

										</div>


									</div>
								</div>

							</div>
						</div>
					</div>
					<div class="box-footer">
						<button ng-show="savebtn.show" type="button"
							class="btn btn-primary" ng-click="save();">保存</button>
						<button ng-show="updatebtn.show" type="button"
							class="btn btn-primary" ng-click="update();">更新</button>
					</div>
				</form>
			</div>
		</div>
		<div class="box-footer"></div>
	</div>
</section>
<script>
$(function(){
	$(".select2").select2();
	
});

</script>
